/**
 * 
 */
package org.lanqiao.netctoss.service.impl;

import java.sql.Timestamp;
import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.lanqiao.netctoss.dao.AcountDao;
import org.lanqiao.netctoss.entity.Acount;
import org.lanqiao.netctoss.entity.Admin;
import org.lanqiao.netctoss.service.AcountService;
import org.lanqiao.netctoss.util.GetSession;

/**
 * @author Administrator
 *
 */
public class AcountServiceImpl implements AcountService {

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#selectNow()
	 */
	@Override
	public Timestamp selectNow() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#insertAcount(org.lanqiao.netctoss.entity.Acount)
	 */
	@Override
	public int insertAcount(Acount acount) {
		// TODO Auto-generated method stub
		SqlSession session = GetSession.getSession();
		AcountDao acountDao = session.getMapper(AcountDao.class);
		int i= acountDao.insertAcount(acount);
		session.commit();
		GetSession.close();
		return i;
	}

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#deleteAcount(org.lanqiao.netctoss.entity.Acount)
	 */
	@Override
	public int deleteAcount(Acount acount) {
		// TODO Auto-generated method stub
		SqlSession session = GetSession.getSession();
		AcountDao acountDao = session.getMapper(AcountDao.class);
		int i= acountDao.deleteAcount(acount);
		session.commit();
		GetSession.close();
		return i;
	}

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#updateAcount(org.lanqiao.netctoss.entity.Acount)
	 */
	@Override
	public int updateAcount(Acount acount) {
		// TODO Auto-generated method stub
		SqlSession session = GetSession.getSession();
		AcountDao acountDao = session.getMapper(AcountDao.class);
		int i= acountDao.updateAcount(acount);
		session.commit();
		GetSession.close();
		return i;
	}

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#updateAcountByno(org.lanqiao.netctoss.entity.Acount)
	 */
	@Override
	public int updateAcountByno(Acount acount) {
		// TODO Auto-generated method stub
		SqlSession session = GetSession.getSession();
		AcountDao acountDao = session.getMapper(AcountDao.class);
		int i= acountDao.updateAcountByno(acount);
		session.commit();
		GetSession.close();
		return i;
	}

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#selectAcountByCondition(org.lanqiao.netctoss.entity.Acount)
	 */
	@Override
	public List<Acount> selectAcountByCondition(Acount acount) {
		// TODO Auto-generated method stub
		SqlSession session = GetSession.getSession();
		AcountDao acountDao = session.getMapper(AcountDao.class);
		List<Acount> la = acountDao.selectAcountByCondition(acount);
		if(la!=null){
			session.commit();
			session.close();
		}
		return null;
	}

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#selectAcount()
	 */
	@Override
	public List<Acount> selectAcount() {
		// TODO Auto-generated method stub
		SqlSession session = GetSession.getSession();
		AcountDao acountDao = session.getMapper(AcountDao.class);
		List<Acount> la = acountDao.selectAcount();
		session.commit();
		GetSession.close();
		return la;
	}

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#selectAcountBycard(org.lanqiao.netctoss.entity.Acount)
	 */
	@Override
	public Acount selectAcountBycard(Acount acount) {
		// TODO Auto-generated method stub
		SqlSession session = GetSession.getSession();
		AcountDao acountDao = session.getMapper(AcountDao.class);
		Acount a = acountDao.selectAcountBycard(acount);
		if(a!=null){
			session.commit();
			session.close();
		}
		return a;
	}

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#selectAcountNo(org.lanqiao.netctoss.entity.Acount)
	 */
	@Override
	public List<Acount> selectAcountNo(Acount acount) {
		// TODO Auto-generated method stub
		SqlSession session = GetSession.getSession();
		AcountDao acountDao = session.getMapper(AcountDao.class);
		List<Acount> la = acountDao.selectAcountNo(acount);
		return la;
	}

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#selectAcountByno(org.lanqiao.netctoss.entity.Acount)
	 */
	@Override
	public List<Acount> selectAcountByno(Acount acount) {
		// TODO Auto-generated method stub
		SqlSession session = GetSession.getSession();
		AcountDao acountDao = session.getMapper(AcountDao.class);
		List<Acount> la = acountDao.selectAcountByno(acount);
		return la;
	}

	/* (non-Javadoc)
	 * @see org.lanqiao.netctoss.service.AcountService#updateBussState(org.lanqiao.netctoss.entity.Acount)
	 */
	@Override
	public int updateBussState(Acount acount) {
		// TODO Auto-generated method stub
		SqlSession session = GetSession.getSession();
		AcountDao acountDao = session.getMapper(AcountDao.class);
		int i = acountDao.updateBussState(acount);
		return i;
	}

}
